subdir('cmds')

# The files() function doesn't accept custom targets (such as vcs_tag)
# Kinda annoying.
app_files = files(
  'app.d',
  'logger.d',
  'util.d',
)

pd_version_file =  vcs_tag(command: ['git', 'rev-parse', '--short', 'HEAD'],
    input: 'vcs_tag.d.in', output: 'vcs_tag.d',
    fallback: 'release')

conf = configuration_data()

version_split = meson.project_version().split('.')
ver_major = version_split[0]
ver_minor = version_split[1]
ver_patch = version_split[2]

conf.set('PROJECT_VERSION_MAJOR', ver_major)
conf.set('PROJECT_VERSION_MINOR', ver_minor)
conf.set('PROJECT_VERSION_PATCH', ver_patch)

conf.set('PROJECT_VERSION_STRING', meson.project_version())

conf_file = configure_file(input: 'config.d.in',
    output: 'config.d',
    configuration: conf)

app_files += cmds_files
app_files += pd_version_file[0]
app_files += conf_file
